use git_tools::app;
use service::*;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    app::bootstrap::init().await?;
    let client =
        gitlab_api_service::new_gitlab_client("10.101.37.217", "xMyjD_gnvAm9tDdraRMy", false)
            .await?;
    let mut project_service = gitlab_api_service::ProjectService::new(client);

    loop {
        let result = project_service.next_query().await?;
        if result.is_empty() {
            break;
        }
        let len = result.len();
        gitlab_info_service::save_projects(1, result).await?;
        tracing::info!("查询项目 {} 个", len);
    }
    let proj = bean::Project {
        id: 1,
        name: "2".to_owned(),
        web_url: "3".to_owned(),
        created_at: chrono::Utc::now(),
    };

    println!("{:?}", serde_json::to_string(&proj));
    Ok(())
}
